package com.testingedu.common;

import java.util.List;


/**
 * 查询结果集进行封装类
 * 
 * @author lsww
 * @E-mail lsww.sc@Gmail.com 2012-7-8 下午04:50:56
 * 
 */	
 public class QueryResult implements java.io.Serializable {

		private static final long serialVersionUID = 1L;
		private Long allCount; // 总记录条数
		private Long allPage; // 总页数
		private Long currentPage; // 当前页数
		private Long pageSize; // 一页包含的记录条数
		private List<?> resultList;//i结果集
		private Long startRow;//其实行
		public QueryResult() {
			this.currentPage = 1l;
			this.pageSize = 11l; // 默认每页显示10条记录
			this.allCount = 0l;
			this.allPage = 1l;
		}

		public Long getAllCount() {
			return allCount;
		}

		public Long getAllPage() {
			return allPage;
		}

		public Long getCurrentPage() {
			return currentPage;
		}

		public Long getPageSize() {
			return pageSize;
		}

		public List<?> getResultList() {
			return resultList;
		}

		public Long getStartRow() {	//计算并返回起始行
			startRow = (this.currentPage - 1) * this.pageSize;
			return startRow;
		}

		public void setAllCount(Long allCount) {
			if (allCount > 0) {		//计算总页数
				allPage = allCount % pageSize == 0 ? allCount / pageSize
						: (allCount / pageSize + 1);
			}
			this.allCount = allCount;
		}

		public void setAllPage(Long allPage) {
			this.allPage = allPage;
		}


		public void setCurrentPage(Long currentPage) {
			this.currentPage = currentPage;
		}

		public void setPageSize(Long pageSize) {
			this.pageSize = pageSize;
		}

		public void setResultList(List<?> resultList) {
			this.resultList = resultList;
		}

		public void setStartRow(Long startRow) {
			this.startRow = startRow;
		}
	}
